home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kit PC World De Ampliacion De Windows 95
/
Kit PC World de ampliacion de Windows 95.iso
/
internet
/
sweeper
/
samples
/
olecon~1
/
wizards
/
transfrm.frm
< prev
next >
Wrap
Text File
|
1995-12-04
|
14KB
|
348 lines
VERSION 4.00
Begin VB.Form frmTransform
BorderStyle = 3 'Fixed Dialog
Caption = "Generating OLE Control"
ClientHeight = 1725
ClientLeft = 4110
ClientTop = 5520
ClientWidth = 6090
ControlBox = 0 'False
Height = 2145
Left = 4050
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1725
ScaleWidth = 6090
ShowInTaskbar = 0 'False
Top = 5160
Width = 6210
Begin ComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 600
TabIndex = 1
Top = 840
Width = 4815
_Version = 65536
_ExtentX = 8493
_ExtentY = 450
_StockProps = 192
Appearance = 1
End
Begin VB.Label lblmessage
Alignment = 2 'Center
Caption = "Label1"
Height = 495
Left = 600
TabIndex = 0
Top = 120
Width = 4695
End
End
Attribute VB_Name = "frmTransform"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long _
)
Dim m_szGuidLibid As String
Dim m_szGuidPrimaryDispatch As String
Dim m_szGuidEventInterface As String
Dim m_szGuidCoClass As String
Dim m_szGuidPropPage As String
Private Sub Form_Load()
Show
On Error GoTo Blech
If Dir(szSourceDir) = "" Then
Blech:
szSourceDir = InputBox("Unable to find Template files in '" + szFinalDir + "'. Please Enter an alternate location.", "Control Wizard")
End If
On Error GoTo 0
If g_fLoser = True Then szControlName = Left(szControlName, 8)
lblmessage.Caption = "Creating Directories"
Refresh
m_CreateDirs
ProgressBar1.Value = 25
lblmessage.Caption = "Generating GUIDs"
Refresh
m_MakeGUIDs
ProgressBar1.Value = 50
lblmessage.Caption = "Copying over control files"
Refresh
m_CopyFiles
ProgressBar1.Value = 75
lblmessage.Caption = "Setting up control"
Refresh
m_ReplaceNames
ProgressBar1.Value = 100
Refresh
End Sub
Sub m_MakeGUIDs()
m_szGuidLibid = GenerateUUID
m_szGuidPrimaryDispatch = GenerateUUID
m_szGuidEventInterface = GenerateUUID
m_szGuidCoClass = GenerateUUID
m_szGuidPropPage = GenerateUUID
End Sub
Private Sub m_CreateDirs()
On Error GoTo die
MkDir szFinalDir
MkDir szFinalDir + "\Release"
MkDir szFinalDir + "\Debug"
If g_fSatellite = True Then MkDir szFinalDir + "\French"
Exit Sub
die:
MsgBox "Couldn't Create directories"
End
End Sub
Private Sub m_CopyFiles()
Dim s As String
If g_fLoser = True Then
s = Left(szControlName, 5)
Else
s = szControlName
End If
FileCopy szSourceDir + "\dispids.h", szFinalDir + "\Dispids.h"
FileCopy szSourceDir + "\guids.cpp", szFinalDir + "\Guids.Cpp"
FileCopy szSourceDir + "\guids.h", szFinalDir + "\Guids.H"
FileCopy szSourceDir + "\LocalObj.H", szFinalDir + "\LocalObj.H"
FileCopy szSourceDir + "\Makefile", szFinalDir + "\Makefile"
FileCopy szSourceDir + "\Resource.H", szFinalDir + "\Resource.H"
FileCopy szSourceDir + "\Template.Bmp", szFinalDir + "\" + s + "Ctl.Bmp"
FileCopy szSourceDir + "\Template.Cpp", szFinalDir + "\" + szControlName + ".Cpp"
FileCopy szSourceDir + "\Template.Def", szFinalDir + "\" + szControlName + ".Def"
FileCopy szSourceDir + "\Template.ODL", szFinalDir + "\" + szControlName + ".ODL"
If g_fSatellite = False Then
FileCopy szSourceDir + "\Template.RC", szFinalDir + "\" + szControlName + ".RC"
Else
FileCopy szSourceDir + "\TemplSat.RC", szFinalDir + "\" + szControlName + ".RC"
End If
If g_szSubClassName = "" Then
FileCopy szSourceDir + "\TemplCtl.Cpp", szFinalDir + "\" + s + "Ctl.Cpp"
Else
FileCopy szSourceDir + "\SubClCtl.Cpp", szFinalDir + "\" + s + "Ctl.Cpp"
End If
FileCopy szSourceDir + "\TemplCtl.H", szFinalDir + "\" + s + "Ctl.H"
FileCopy szSourceDir + "\templPPG.Cpp", szFinalDir + "\" + s + "PPG.Cpp"
FileCopy szSourceDir + "\templppg.h", szFinalDir + "\" + s + "PPG.H"
FileCopy szSourceDir + "\Debug\Make.Bat", szFinalDir + "\Debug\Make.Bat"
FileCopy szSourceDir + "\Release\Make.Bat", szFinalDir + "\Release\Make.Bat"
If g_fSatellite = True Then
FileCopy szSourceDir + "\French\make.bat", szFinalDir + "\French\make.bat"
FileCopy szSourceDir + "\French\Makefile", szFinalDir + "\French\Makefile"
FileCopy szSourceDir + "\French\Template.odl", szFinalDir + "\French\" + s + "Sat.Odl"
FileCopy szSourceDir + "\French\TemplSat.Cpp", szFinalDir + "\French\" + s + "Sat.Cpp"
FileCopy szSourceDir + "\French\TemplSat.Def", szFinalDir + "\French\" + s + "Sat.Def"
FileCopy szSourceDir + "\French\TemplSat.Rc", szFinalDir + "\French\" + s + "Sat.Rc"
End If
End Sub
Private Sub m_ReplaceNames()
Dim s As String
If g_fLoser = True Then
s = Left(szControlName, 5)
Else
s = szControlName
End If
ReplaceFile szFinalDir + "\Dispids.H", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\Dispids.H", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\Dispids.H", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\guids.cpp", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\guids.cpp", "<<DEFSERVERNAME>>", szControlName
ReplaceFile szFinalDir + "\guids.cpp", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\guids.cpp", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\guids.h", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\guids.H", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\guids.H", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\localobj.H", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\localobj.H", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\localobj.H", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\makefile", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\makefile", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\makefile", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\resource.h", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\resource.h", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\resource.H", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + szControlName + ".cpp", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szControlName + ".cpp", "<<DEFSERVERNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szControlName + ".cpp", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + szControlName + ".cpp", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + szControlName + ".cpp", "<<USESSATELLITELOCALIZATION>>", UCase(Str$(g_fSatellite))
ReplaceFile szFinalDir + "\" + szControlName + ".def", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szControlName + ".def", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + szControlName + ".def", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + szControlName + ".odl", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szControlName + ".odl", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + szControlName + ".odl", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + szControlName + ".odl", "<<GUID_LIBID>>", m_szGuidLibid
ReplaceFile szFinalDir + "\" + szControlName + ".odl", "<<GUID_PRIMARYDISPATCH>>", m_szGuidPrimaryDispatch
ReplaceFile szFinalDir + "\" + szControlName + ".odl", "<<GUID_EVENTINTERFACE>>", m_szGuidEventInterface
ReplaceFile szFinalDir + "\" + szControlName + ".odl", "<<GUID_COCLASS>>", m_szGuidCoClass
ReplaceFile szFinalDir + "\" + szControlName + ".rc", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + szControlName + ".rc", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + szControlName + ".rc", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + s + "Ctl.Cpp", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + s + "Ctl.Cpp", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + s + "Ctl.Cpp", "<<DEFCONTROLTRUNCNAME>>", s
If g_szSubClassName <> "" Then ReplaceFile szFinalDir + "\" + s + "Ctl.Cpp", "<<SUBCLASSWINDOWCLASS>>", g_szSubClassName
ReplaceFile szFinalDir + "\" + s + "Ctl.h", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + s + "Ctl.h", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + s + "Ctl.h", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + s + "PPG.Cpp", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + s + "PPG.Cpp", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + s + "PPG.Cpp", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + s + "PPG.h", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\" + s + "PPG.h", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\" + s + "PPG.h", "<<DEFCONTROLTRUNCNAME>>", s
ReplaceFile szFinalDir + "\" + "guids.H", "<<PPGGUID>>", GetPPGGuidString
If g_fSatellite = True Then
ReplaceFile szFinalDir + "\French\Makefile", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.Def", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.Rc", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.Rc", "<<DEFCONTROLNAMECAPS>>", UCase(szControlName)
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<DEFCONTROLNAME>>", szControlName
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_LIBID>>", m_szGuidLibid
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_PRIMARYDISPATCH>>", m_szGuidPrimaryDispatch
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_EVENTINTERFACE>>", m_szGuidEventInterface
ReplaceFile szFinalDir + "\French\" + s + "Sat.ODL", "<<GUID_COCLASS>>", m_szGuidCoClass
End If
End Sub
Function ReplaceData(ByVal sData As String, ByVal sInToken As String, ByVal sOutToken As String) As String
If Len(sData) = 0 Then Exit Function
Dim iLast As Integer
Dim sPart As String
Dim sTemp As String
sTemp = sData
'Now do double quotes
iLast = InStr(sData, sInToken)
While iLast
sPart = sPart & Left$(sData, iLast - 1) & sOutToken
sData = Right$(sData, Len(sData) - iLast - Len(sInToken) + 1)
iLast = InStr(sData, sInToken)
Wend
sData = sPart & sData
'Debug.Print sData
ReplaceData = sData
End Function
Function ReplaceFile(ByVal sInName As String, ByVal sInToken As String, ByVal sOutToken As String) As Boolean
Dim iFNum As Integer
Dim iFOut As Integer
Dim sHead As String
Dim sTemp As String
On Error GoTo fncopnerr
'Open the files
iFNum = FreeFile
Open sInName For Input As #iFNum
iFOut = FreeFile
Open szFinalDir + "\moo.Tmp" For Output As #iFOut
Do Until EOF(iFNum)
Line Input #iFNum, sTemp
sTemp = ReplaceData(sTemp, sInToken, sOutToken)
Print #iFOut, sTemp
Loop
Close #iFNum
Close #iFOut
Kill sInName
Name szFinalDir + "\moo.tmp" As sInName
ReplaceFile = True
Exit Function
fncopnerr:
MsgBox "Reap File Error - " & Error$ & ""
' Resume
ReplaceFile = False
Exit Function
End Function
Function GenerateUUID() As String
Shell "uuidgen -oMaggots.987"
Call Sleep(2000)
Open "Maggots.987" For Input As 1
Line Input #1, GenerateUUID
Close #1
Kill "maggots.987"
End Function
Function GetPPGGuidString() As String
Dim s As String
s = "DEFINE_GUID(CLSID_" + szControlName + "GeneralPage, 0x" + Left(m_szGuidPropPage, 8) _
+ ", 0x" + Mid(m_szGuidPropPage, 10, 4) + ", 0x" + Mid(m_szGuidPropPage, 15, 4) _
+ ", 0x" + Mid(m_szGuidPropPage, 20, 2) + ", 0x" + Mid(m_szGuidPropPage, 22, 2) _
+ ", 0x" + Mid(m_szGuidPropPage, 25, 2) + ", 0x" + Mid(m_szGuidPropPage, 27, 2) _
+ ", 0x" + Mid(m_szGuidPropPage, 29, 2) + ", 0x" + Mid(m_szGuidPropPage, 31, 2) _
+ ", 0x" + Mid(m_szGuidPropPage, 33, 2) + ", 0x" + Mid(m_szGuidPropPage, 35, 2) _
+ ");"
GetPPGGuidString = s
End Function
Private Sub lblmessage_Click()
End Sub